<template>
  <h2>setup属性结合ts</h2>
  <p>count: {{ count }}</p>
  <p>doubleCount: {{ doubleCount }}</p>
  <button @click="add()">++</button>
  <Child :count="count" @abc="add" />
</template>

<script setup lang="ts">
import { ref, computed } from "vue";
import Child from "./Child2.vue";

const count = ref<number>(3);
const add = (n?: number): void => {
  if (n) {
    count.value += n;
  }
};

const doubleCount = computed<number>(() => {
  return count.value * 2;
});
</script>
